﻿using DevExpress.XtraGrid.Demos.util;
using Luna小店.DTO;
using mendian;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Luna小店.model
{
    public class KashiyamaUSOrderDesignModel
    {
        public String version = "1";
        public Dictionary<String, String> 设计点对应关系 { get; set; } = new Dictionary<string, string>();
        public Dictionary<String, DTO默认设计点> 设计点类型关系 { get; set; } = new Dictionary<string, DTO默认设计点>();

        public KashiyamaUSOrderDesignModel() {
            //根据版本获取设计点关系
            this.设计点对应关系 = FunctionHelper.JsonDeserialization<Dictionary<String, String>>(RestCall.httpGetMethod(URL.接口url + "/kashiyamaUS/DesignRelation?version=" + this.version));
            //获取默认设计点关系，数据循环加入设计点类型关系的map
            foreach (DTO默认设计点关系 item in FunctionHelper.JsonDeserialization<List<DTO默认设计点关系>>(RestCall.httpGetMethod(URL.接口url + "/kashiyamaUS/DefaultDesign")))
            {
                this.设计点类型关系.Add(item.orderContent, new DTO默认设计点(item.itemCd, item.itemValue));
            }
        }

    }
    public class DTO默认设计点关系
    {
        public String itemCd { get; set; }

        public String itemValue { get; set; }
        public String orderContent { get; set; }
        public DTO默认设计点关系(String orderContent, String itemCd, String itemValue)
        {
            this.orderContent = orderContent;
            this.itemCd = itemCd;
            this.itemValue = itemValue;
        }
    }
}
